package cn.example.vip.mall.user.config;

import cn.example.vip.mall.user.interceptor.AuthHandlerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 关于分页拦截器，因为Springboot兼容性问题，导致 WebMvcConfigurer 的配置会被 WebMvcConfigurationSupport 覆盖掉而无法生效
 * */
public class AuthMvcConfig extends WebMvcConfigurationSupport {
	@Autowired
	private AuthHandlerInterceptor authHandlerInterceptor;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// 设置放行
		registry.addInterceptor(authHandlerInterceptor)
			.addPathPatterns("/**")
			.excludePathPatterns("/**/error", "/user/login/**", "/user/logout/**", "/user/register/**", "/web/search/**");
//		WebMvcConfigurer.super.addInterceptors(registry);
	}
}
